package com.yang.factory;

import java.util.HashMap;
import java.util.Map;
//实例工厂方法，现需要创建对象在调用
public class InstanceCarFactory {
    private Map<String,Car> cars = null;

    public InstanceCarFactory() {
        cars=new HashMap<String, Car>();
        cars.put("Audi",new Car("audi",300000));
        cars.put("ford",new Car("ford",400000));
    }
    public Car getCar(String name){
        return cars.get(name);
    }
}
